package org.dingyom.user.rabbitMQ.handler;

import com.rabbitmq.client.Channel;
import org.dingyom.basics.service.IEmailService;
import org.dingyom.user.config.RegisterNoticeRabbitmqConfig;
import org.dingyom.user.dto.RegisterNoticeDto;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * rabbitmq 用户 接收邮件的消息队列 进行处理
 */
@Component
public class RegisterNoticeEmailReceiveHandler {
    @Autowired
    IEmailService emailService;
    //监听email队列
    @RabbitListener(queues = {RegisterNoticeRabbitmqConfig.QUEUE_INFORM_EMAIL})
    public void receive_email(RegisterNoticeDto registerNoticeDto, Message message, Channel channel) {
        System.out.println(registerNoticeDto.getReceiver());
        System.out.println(registerNoticeDto.getContent());

        //使用email技术进行发送
        //emailService.registerSuccess(registerNoticeDto.getReceiver(), registerNoticeDto.getContent());
    }
}



